<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <body>

        <ui:composition template="./../../template.xhtml">

            <ui:define name="title">CS - Tesouraria</ui:define>
            
            <ui:define name="mainMenu">
                <ui:include src="./../../mainMenu.xhtml" />
            </ui:define>
            
            <ui:define name="subtitle"><h:outputLabel value="Tesouraria > Cadastrar Tipo de Lançamento"/></ui:define>

            <ui:define name="leftMenu">
                <ui:include src="menuTesouraria.xhtml" />
            </ui:define>
            
            <ui:define name="content">
                <center>
                    <h4><h:outputLabel value="Tipo de Lançamento "/></h4>
                </center>
                <p/>
                <h:form>                    
                    <div align="right">
                        <h:selectOneMenu id="filterLancamento" value="#{lancamentoMB.filterName}" >
                            <f:selectItem itemLabel="Descrição" itemValue="descricao" />
                            <f:selectItem itemLabel="Código" itemValue="codigo" />
                        </h:selectOneMenu>

                        <h:inputText id="filterValue" size="30" value="#{lancamentoMB.filterValue}" />
                        <h:commandButton value="Filtrar" action="#{lancamentoMB.filtrar}" />
                    </div>
                    
                    <h:panelGrid columns="4">
                        <h:panelGroup>
                            <h:outputLabel value="Código"/><br/>
                            <h:inputText id="lancamentoID" size="5" value="#{lancamentoMB.lancamento.codigo}"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Tipo"/><br/>
                            <h:selectOneMenu id="tipoID" value="#{lancamentoMB.lancamento.tipo}">
                                <f:selectItem itemLabel="Crédito" itemValue="CRED"/>
                                <f:selectItem itemLabel="Débito" itemValue="DEB"/>
                            </h:selectOneMenu>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:outputLabel value="Descrição"/><br/>
                            <h:inputText id="descricaoID" size="20" value="#{lancamentoMB.lancamento.descricao}"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:commandButton id="incluirID" value="Incluir" action="#{lancamentoMB.salvar}"/>
                        </h:panelGroup>
                    </h:panelGrid>
   
                    
                    <!-- BEGIN - tabela prime faces -->                  
                    <p:dataTable id="dataTable" var="lancamento" value="#{lancamentoMB.lancamentos}"  
                                  paginator="true" rows="10"  
                                  paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                  rowsPerPageTemplate="5,10,15">  

                        <p:column sortBy="#{lancamento.codigo}">  
                             <f:facet name="header">  
                                 <h:outputText value="Código" />  
                             </f:facet>  
                             <h:outputText value="#{lancamento.codigo}" />  
                         </p:column>
                        
                        <p:column sortBy="#{lancamento.tipo}">  
                             <f:facet name="header">  
                                 <h:outputText value="Tipo" />  
                             </f:facet>  
                             <h:outputText value="#{lancamento.tipo}" />  
                         </p:column>  

                        <p:column sortBy="#{lancamento.descricao}">  
                             <f:facet name="header">  
                                 <h:outputText value="Descrição" />  
                             </f:facet>  
                             <h:outputText value="#{lancamento.descricao}" />  
                         </p:column>  

                         <p:column>  
                             <f:facet name="header">  
                                 <h:outputText value="Ação" />  
                             </f:facet>  
                             <h:commandLink action="#{lancamentoMB.remover}" >
                                 <h:graphicImage library="imagens" name="delete.ico" alt="Remover" title="Remover"/>
                             </h:commandLink> 
                         </p:column>  

                    </p:dataTable> 
                    <!-- END - tabela prime faces -->
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
